package security

import (
	"sync"
)

// MalwareSummary 结构体
type MalwareSummary struct {
	// 恶意代码数量信息(任务完成时才返回)
	MalwareCount *MalwareCount `json:"malware_count,omitempty" xml:"malware_count,omitempty"`
	// 子任务状态: 1-已完成,2-处理中,3-处理出错,4-处理超时
	Status int64 `json:"status,omitempty" xml:"status,omitempty"`
}

var poolMalwareSummary = sync.Pool{
	New: func() any {
		return new(MalwareSummary)
	},
}

// GetMalwareSummary() 从对象池中获取MalwareSummary
func GetMalwareSummary() *MalwareSummary {
	return poolMalwareSummary.Get().(*MalwareSummary)
}

// ReleaseMalwareSummary 释放MalwareSummary
func ReleaseMalwareSummary(v *MalwareSummary) {
	v.MalwareCount = nil
	v.Status = 0
	poolMalwareSummary.Put(v)
}
